package org.com.action.user;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;
import org.com.common.LogInfo;
import org.com.dao.RegistDao;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;

@SuppressWarnings("serial")
public class UserDeleteAction extends ActionSupport implements Preparable, ServletRequestAware, SessionAware {

	RegistDao dao;
	HttpServletRequest request;
	Map<String, Object> session;
	
	public Map<String, Object> getSession() {
		
		return session;
	}
	
	@Override
	public String execute() throws Exception {
		String num = (String) request.getParameter("no");
		dao.deleteUser(new Integer(num));
		LogInfo.getLogClassInfo(this.getClass());
		LogInfo.getLogMessageInfo(getSession().toString() + "USER DELETE COMPLETE!!");
		
		return SUCCESS;
	}

	public void prepare() throws Exception {
		dao = new RegistDao();
		
	}

	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
		
	}

	public void setSession(Map<String, Object> session) {
		this.session = session;
		
	}


}
